package com.hliushi.chain.example01_right;

/**
 * 财务经理类 (5000元审批权限)
 *
 * @author: hliushi
 * @date: 2023/2/16 21:58
 **/
public class Manger extends Approver {

    private final int MAX_AMOUNT = 5000;

    public Manger(String name) {
        super(name);
    }

    public void approve(int amount) {
        if (amount <= MAX_AMOUNT) {
            System.out.printf("审批通过，报销金额 ¥%s。【经理: %s】\n", amount, name);
        } else {
            System.out.printf("无权审批，升级处理。【经理: %s】\n", name);
            nextApprover.approve(amount);
        }
    }
}
